Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename branch status modif by operational status modif #377

Closed

Conversation

ghazwarhili
Copy link
Contributor

No description provided.

BRANCH_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST),
BRANCH_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty equipment action type"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty operational status action type ?

BRANCH_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty branch action type"),
BRANCH_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST),
BRANCH_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPERATIONAL_STATUS_ACTION_ERROR

BRANCH_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST),
BRANCH_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty equipment action type"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPERATIONAL_STATUS_ACTION_TYPE_EMPTY

BRANCH_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty equipment action type"),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPERATIONAL_STATUS_ACTION_TYPE_UNKNOWN

OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty equipment action type"),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST),
OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPERATIONAL_STATUS_ACTION_TYPE_UNSUPPORTED

@@ -150,8 +150,8 @@ public static NetworkModificationException createEquipmentTypeUnknown(@NonNull S
return new NetworkModificationException(Type.UNKNOWN_EQUIPMENT_TYPE, "The equipment type : " + type + " is unknown");
}

public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull BranchStatusModificationInfos.ActionType type) {
return new NetworkModificationException(Type.BRANCH_ACTION_TYPE_UNSUPPORTED, "The branch action type : " + type + " is unsupported");
public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull OperationalStatusModificationInfos.ActionType type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createOperationalStatusActionTypeUnsupported

public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull BranchStatusModificationInfos.ActionType type) {
return new NetworkModificationException(Type.BRANCH_ACTION_TYPE_UNSUPPORTED, "The branch action type : " + type + " is unsupported");
public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull OperationalStatusModificationInfos.ActionType type) {
return new NetworkModificationException(Type.OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNSUPPORTED, "The branch action type : " + type + " is unsupported");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operational status action type : " + type + " is unsupported

public class BranchStatusModificationInfos extends EquipmentModificationInfos {
@Schema(description = "Operational status modification")
@JsonTypeName("OPERATIONAL_STATUS_MODIFICATION")
@ModificationErrorTypeName("OPERATIONAL_EQUIPMENT_ACTION_ERROR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPERATIONAL_STATUS_ACTION_ERROR


private void applyTripEquipment(Reporter subReporter, Identifiable<?> equipment, String equipmentTypeName, Network network) {
Tripping trip = null;
if (equipment instanceof Branch<?>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a method to return the tripping class to use from the equiment type

And throw an exception the equipement type is not treated

traversedTerminals.stream().map(t -> network.getIdentifiable(t.getConnectable().getId()))
.filter(Objects::nonNull)
.filter(distinctByKey(b -> b.getId())) // dont process the same branch more than once
.forEach(b -> b.newExtension(BranchStatusAdder.class).withStatus(BranchStatus.Status.FORCED_OUTAGE).add());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a method which add the extension type from the the equipment type

…ationalStatusModif' into rename-BranchStatusModif-to-OperationalStatusModif
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

80.6% 80.6% Coverage
0.0% 0.0% Duplication

throw NetworkModificationException.createEquipmentTypeUnknown(identifiable.getClass().getSimpleName());
}

public Tripping getTrippingFromIdentifiable(@NonNull Identifiable<?> identifiable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This methos is specific to the operation status modification
Move it

@@ -514,6 +520,39 @@ public Terminal getTerminalFromIdentifiable(Network network, String equipmentId,
return null;
}

public Set<Terminal> getTerminalsFromIdentifiable(@NonNull Identifiable<?> identifiable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a set ?

return new BranchTripping(branch.getId());
} else if (identifiable instanceof ThreeWindingsTransformer w3t) {
return new ThreeWindingsTransformerTripping(w3t.getId());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HVDC ?

hvdcLine.getConverterStation2().getTerminal()
).collect(Collectors.toSet());
}
throw NetworkModificationException.createEquipmentTypeUnknown(identifiable.getClass().getSimpleName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This methos is specific to the operation status modification
Move it
And throw equipmentTypeNotSupported
Use powsybl getTerminals method

return new ThreeWindingsTransformerTripping(w3t.getId());
}
throw NetworkModificationException.createOperationalStatusActionTypeUnsupported(OperationalStatusModificationInfos.ActionType.TRIP);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw equipmentTypeNotSupported

…sModif

# Conflicts:
#	src/main/resources/db/changelog/db.changelog-master.yaml
@ghazwarhili ghazwarhili closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants